<div class="span3">
    <div class="well sidebar-nav">
        <ul class="nav nav-list">
            <li class="nav-header"><?php echo __d('cake', 'Actions'); ?></li>
        <li><?php echo $this->Html->link(__('Edit Product'), array('action' => 'edit', $product['Product']['id'])); ?> </li>
        <li><?php echo $this->Form->postLink(__('Delete Product'), array('action' => 'delete', $product['Product']['id']), null, __('Are you sure you want to delete # %s?', $product['Product']['id'])); ?> </li>
        <li><?php echo $this->Html->link(__('List Products'), array('action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Product'), array('action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Images'), array('controller' => 'images', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Image'), array('controller' => 'images', 'action' => 'add')); ?> </li>
        </ul>
    </div>
</div>

<div class="span9">
    <?php echo $this->Session->flash(); ?>
    <div class="page-header">
        <h1><?php  echo __('Producto'); ?></h1>
    </div>
    <dl>
        <dt><?php echo __('Id'); ?></dt>
        <dd>
            <?php echo h($product['Product']['id']); ?>
            &nbsp;
        </dd>
        <dt><?php echo __('Titulo'); ?></dt>
        <dd>
            <?php echo h($product['Product']['title']); ?>
            &nbsp;
        </dd>
        <dt><?php echo __('Medidas'); ?></dt>
        <dd>
            <?php echo h($product['Product']['lead']); ?>
            &nbsp;
        </dd>
        <dt><?php echo __('Cobertura'); ?></dt>
        <dd>
            <?php echo h($product['Product']['coverage']); ?>
            &nbsp;
        </dd>        
        <dt><?php echo __('Caracteristicas'); ?></dt>
        <dd>
            <?php echo h($product['Product']['body']); ?>
            &nbsp;
        </dd>
        <dt><?php echo __('Archivo'); ?></dt>
        <dd>
        <?php if (h($product['Product']['technical'])): ?>        
            <?php $link = $this->Html->url(h($product['Product']['technical']), true ); ?>
            <a href="<?php echo $link ?>" title="descargue el archivo"><?php echo __('Descargue el archivo') ?></a>
        <?php endif; ?>        
            &nbsp;
        </dd>
        <dt><?php echo __('Activo'); ?></dt>
        <dd>
            <?php echo h($product['Product']['is_active']); ?>
            &nbsp;
        </dd>
        <dt><?php echo __('Created'); ?></dt>
        <dd>
            <?php echo h($product['Product']['created']); ?>
            &nbsp;
        </dd>
        <dt><?php echo __('Modified'); ?></dt>
        <dd>
            <?php echo h($product['Product']['modified']); ?>
            &nbsp;
        </dd>
    </dl>
</div>



<div class="related">
    <h3><?php echo __('Imagenes Relacionadas'); ?></h3>
    <?php if (!empty($product['Image'])): ?>
    <table class="table table-bordered table-striped">
    <thead>
    <tr>
        <th><?php echo __('Id'); ?></th>
        <th><?php echo __('Product Id'); ?></th>
        <th><?php echo __('Filename'); ?></th>
        <th><?php echo __('Filepath'); ?></th>
        <th><?php echo __('Type'); ?></th>
        <th><?php echo __('Height'); ?></th>
        <th><?php echo __('Width'); ?></th>
        <th><?php echo __('Is Active'); ?></th>
        <th><?php echo __('Created'); ?></th>
        <th><?php echo __('Modified'); ?></th>
        <th colspan="3"><?php echo __('Actions'); ?></th>
    </tr>
    </thead>
    <tbody>
    <?php
        $i = 0;
        foreach ($product['Image'] as $image): ?>
           <?php 
           if (!empty($image['filepath'])) {
                $img = $this->Html->url($image['filepath'], true );
                $this->Fancybox->setProperties( array( 
                    'class' => 'fancybox3',
                    'className' => 'fancybox.image',
                    'title'=> $image['filename'],
                    'rel' => 'gallery1'
                    )
                );  
                $this->Fancybox->setPreviewContent('Ver imagen');
                $this->Fancybox->setMainContent($img);  
                $fancybox = $this->Fancybox->output();
            }          
            ?>
        <tr>
            <td><?php echo $image['id']; ?></td>
            <td><?php echo $image['product_id']; ?></td>
            <td><?php echo $image['filename']; ?></td>
            <td><?php echo isset($fancybox) ? $fancybox : ''; ?></td>
            <td><?php echo $image['type']; ?></td>
            <td><?php echo $image['height']; ?></td>
            <td><?php echo $image['width']; ?></td>
            <td><?php echo $image['is_active']; ?></td>
            <td><?php echo $image['created']; ?></td>
            <td><?php echo $image['modified']; ?></td>
            <td>
                <?php echo $this->Html->link(__('View'), array('controller' => 'images', 'action' => 'view', $image['id']), array('class' => 'btn btn-info')); ?>
            </td>
            <td>
                <?php echo $this->Html->link(__('Edit'), array('controller' => 'images', 'action' => 'edit', $image['id']), array('class' => 'btn btn-warning')); ?>
            <td>
                <?php echo $this->Form->postLink(__('Delete'), array('controller' => 'images', 'action' => 'delete', $image['id']), array('class' => 'btn btn-danger'), __('Are you sure you want to delete # %s?', $image['id'])); ?>
            </td>
        </tr>
    <?php endforeach; ?>
    </tbody>
    </table>
<?php endif; ?>

    <div class="well">
        <?php echo $this->Html->link(__('Nueva Imagen'), array('controller' => 'images', 'action' => 'add'), array('class' => 'btn btn-primary')); ?> 
    </div>
</div>
